package com.ryan.spring.cloud.gateway.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;

/**
 * Created by kaimin on 22/1/2019.
 * time : 08:58
 * spring boot程序启动之后，会检查程序中是否有commandLineRunner和ApplicationRunner接口实例
 * 如果存在的话，就执行对应实现中的run方法，而且只执行一次
 */
public class GatewayStartup implements ApplicationRunner {
    @Autowired
    private GateWayDefineService gateWayDefineService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        gateWayDefineService.loadRouteDefinition();
    }
}
